package com.ice.work.organization.user.mapper;

import com.honeybee.cloud.framework.common.mapper.BaseCovertMapper;
import com.ice.work.organization.facadeuser.dto.UserDTO;
import com.ice.work.organization.facadeuser.model.User;
import com.ice.work.organization.facadeuser.request.AddUserRequest;
import com.ice.work.organization.facadeuser.vo.UserVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @Description UserConvertMapper
 * @Author DELL
 * @Create 2019-01-09
 * @Since 1.0.0
 */
@Mapper
public interface UserConvertMapper extends BaseCovertMapper {
    UserConvertMapper INSTANCE = Mappers.getMapper(UserConvertMapper.class);


    /**
     * toDTO
     *
     * @param user
     * @return
     */
    UserDTO toDTO(User user);

    /**
     * toModel
     *
     * @param request
     * @return
     */
    @Mappings({
            @Mapping(target = "addTime", source = "addTime", qualifiedByName = "longToInt")
    })
    User toModel(AddUserRequest request);

    /**
     * toVO
     *
     * @param userDTO
     * @return
     */
    UserVO toVO(UserDTO userDTO);

}
